home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 001-010 / amok07 / queue / queue.def < prev    next >
Encoding:
Modula Definition  |  1993-11-04  |  1.7 KB  |  60 lines

  1. (*********************************************************************
  2.  *
  3.  *  :Program.    Queue.def
  4.  *  :Author.     Michael Frieß
  5.  *  :Address.    Kernerstr. 22a
  6.  *  :shortcut.   [MiF]
  7.  *  :Version.    1.0
  8.  *  :Date.       14.09.88
  9.  *  :Copyright.  PD
  10.  *  :Language.   Modula-II
  11.  *  :Translator. M2Amiga
  12.  *  :Imports.    MemSystem (at least V1.0 --> Amok#5)
  13.  *  :Contents.   Generic data type: Queue
  14.  *
  15.  *********************************************************************)
  16.  
  17. DEFINITION MODULE Queue;
  18. (* (C) Copyright 1988 by Michael Frieß *)
  19.  
  20. FROM SYSTEM   IMPORT BYTE, ADDRESS;
  21.  
  22. TYPE queue; (* opaque type! *)
  23.      (* queue is a simple FIFO-list (First-In-First-Out) *)
  24.  
  25. PROCEDURE Init (VAR q:queue);
  26.   (* :output.q = use this variable, when you call queue-procedures
  27.      :semantic.Initialize queue q for further use
  28.   *)
  29.  
  30.  
  31. PROCEDURE Write (q:queue; Data : ARRAY OF BYTE);
  32.   (* :input.q    = data is to be written in this queue
  33.      :input.data = data to be written
  34.      :semantic.a new element is appended at end of queue q
  35.      :semantic.containing the given data.
  36.   *)
  37.  
  38. PROCEDURE Read (q:queue; VAR Data : ARRAY OF BYTE);
  39.   (* :input. q    = read of this queue
  40.      :output.Data = contents of first element in queue
  41.      :semantic.The contents of the first element is read into Data
  42.      :semantic.and first element is deleted from queue.
  43.   *)
  44.  
  45. PROCEDURE Empty (q:queue) : BOOLEAN;
  46.   (* :input.q = queue
  47.      :return.TRUE  : queue is empty
  48.      :return.FALSE : otherwise
  49.      :semantic.returns, whether queue is empty or not.
  50.   *)
  51.  
  52.  
  53. PROCEDURE Discard (VAR q:queue);
  54.   (* :input.q = queue
  55.      :semantic.Memory allocated for queue q is given back to
  56.      :semantic.operating system.
  57.   *)
  58.  
  59. END Queue.
  60.